﻿/***************************************************************
 * Name:      task_manager.cpp
 * Purpose:   下载任务管理器类
 * Author:    杨卓荦 (yzl@bang5.net)
 * Created:   2010-08-29
 * Copyright: 杨卓荦 (http://www.bang5.net)
 * License:
 **************************************************************/

#include "task_manager.h"
using namespace std;
TaskManager::TaskManager() {
  //ctor
}

TaskManager::~TaskManager() {
  //dtor
}

void TaskManager::AddTask(Task* const task) {
  tasks_.push_back(task);
}

Task* TaskManager::GetTask(int task_id) {
  int j = 0;
  for (list<Task*>::iterator i = tasks_.begin(); i != tasks_.end(); ++i, ++j) {
    if (j == task_id) return *i;
  }
  return NULL;
}
